import request, { req } from "@/utils/request";
import {
    Common,
    // addRequirementTypeForm,
    createRequirementForm,
    addProjectNameForm,
    postAvgRequirementForm,
    putCloseFatherRequirementStatusForm,
    putReturnFatherRequirementStatusForm,
    putUpdateRequmentStatusForm,
    getNewFatherRequirementForm,
    postSubmitTestRequirementForm,
    searchRequirementForm,
    postInitRequirementData,
    postPVPRequirementData,
    getRequirementForm,
    postReviewRequirementMsgForm,
    putAddOrUpdateRequirementBossNameForm,
    putShowNeedTipForm,
    getJoinTestData,
    putShowTipCTOYForm,
    postAgainRequirementForm,
    putShowTipJTOYForm,
    postSubmitTestStatusForm,
    submitTestRequirementTwoForm,
    // TODO 需求详情
    postAvgDeleteRequirementForm,
    // TODO 项目经理待上线评审
    postManagerRequirementForm,
    postOfflineBearContentForm,
    getSelectBareUsersFormData,
    postOfflineBearContentMsgForm,
    submitBearContentForm,
    postSelectBareUsersForm,
    // TODO 待上线
    postOfflineToEndForm,
    putOnlineEndBearContentsForm,
} from "./type";

enum NewDemands {
    // PostAddRequirementType = "/item/addRequirementType",//添加需求类型
    PostCreateRequirement = "/item/createRequirement",//创建需求
    PostAddItemItem = "/item/addItemItem",//添加项目名称
    PostInitRequirement = "/item/getInitRequirement",//获取【我负责的需求】
    PostAvgRequirement = "/item/avgRequirement",//分配需求接口
    PutCloseFatherRequirementStatus = "/item/closeFatherRequmentStatus",//关闭主需求
    PostPVPRequirement = "/item/getPvPRequirement",//获取【我的研发任务】
    PutUpdateRequirementStatus = "/item/updateRequmentStatus",//更新childStatus任务状态
    GetNewFatherRequirementStatus = "/item/getNewFatherRequmentStatus",//更新fatherStatus任务状态
    PostSubmitTestRequirement = "/item/submitTestRequment",//提交测试分支
    PostRequirement = "/item/getRequirement",//查询一个需求
    GetCreateRequirement = "/item/getCreateRequirement",//获取【我创建的需求】数据
    GetEnterRequirement = "/item/getEnterRequirement",//获取【待审核】需求
    PostReviewRequirementMsg = "/item/reviewRequirementMsg",//审核需求
    GetUrged = "/item/urgedUrgedUrged",//催促审核,
    PutUpdateBossName = "/item/addOrUpdateRequirementBossName",//选择技术负责人
    GetRequirementEnterMsg = "/item/getRequirementEnterMsg",//获取需求审核记录
    PutShowNeedTip = "/item/showNeedTip",//提交需求评审会议纪要
    GetJoinTests = "/item/getJoinTests",//获取提测人员列表
    PostAgainRequirement = "/item/againSubmitRequirement",// 审核未通过时修改需求
    GetMyRequirementNoTip = "/item/getMyRequirementNoTip",//获取已经提测，未审核的需求
    PutShowTipJTOY = "/item/showTipJTOY",// 技术负责人审核详细设计请求参数
    PutReturnCloseFatherRequirementStatus = "/item/returnCloseFatherRequmentStatus",// 技术负责人撤回已关闭需求
    // TODO 需求详情
    PostAvgDeleteRequirement = "/item/avgDeleteRequirement",// 删除已分配人员
    // TODO 测试中
    PutShowTipCTOY = "/item/showTipCTOY",// 测试通过时测试对研发评分
    GetUpdateSubmitNotTips = "/item/updateSubmitNotTips", // 测试负责人创建的任务测试通过
    PostSubmitTestStatus = "/item/updateSubmitTestStatus",// 测试不通过时提交bug
    GetRequirementsBugs = "item/getRequirementsBugs",// 根据需求id获取所有bug列表
    GetMySubmitByRequirementChild = "/item/getMySubmitByRequirementChild",// 测试人员根据需求id获取提测给自己的研发人员名单
    PostSubmitTestRequirementTwo = "/item/submitTestRequirementTwo", // 需求重新提测
    GetSubmitRequirementList = "/item/getSubmitRequirementList",// 研发人员重新提测时获取自己的提测人员列表
    GetUpdateMySubmitByRequirementStatus = "/item/updateStatusMySubmitByRequirementChild",// 变更自己的提测记录为测试中
    GetSubmitTestMsg = "/item/getSubmitTestMsg",// 获取提测需求详情
    // TODO 待上线评审需求
    PostManagerRequirement = "/item/getManagerRequirements",// 获取项目经理的待上线评审需求
    GetManagerOnline = "/item/pushManagerOnline",// 项目经理通知技术负责人上线评审
    GetSelectBareUsers = "/item/getSelectBareUsers",// 获取上线评审可参与人员列表
    PostSelectBareUsers = "/item/selectBareUsers",// 技术负责人分配参与上线人员
    GetMyBareMsg = "/item/getMyBareMsg",// 获取【我的上线任务】列表
    SubmitBearContent = "/item/submitBearContent", // 提交上线评审负责内容
    PostOfflineBearContent = "/item/pushOfflineBearContent",// 项目经理通知所有上线参与人线下上线评审时间
    PostOfflineBearContentMsg = "/item/pushOfflineBearContentMsg", // 项目经理填写上线评审会议纪要
    GetBareUsersMsgs = "/item/getBareUsersMsgs", // 获取上线评审需求各自负责的内容
    PostUpdateBareUsersMsgs = "/item/selectUpdateBareUsers", // 更新参与上线评审的人各自负责的内容
    GetOnlineUsers = "/item/getSelectBareUsers", // 获取上线参与人列表
    DingDingOnlineWriteBearContents = "/item/dingDingOnlineWriteBearContents", // 提醒编写上线负责任务
    // TODO 待上线
    PostOfflineToEnd = "/item/sucssesOfflineToEnd",// 技术负责人提交上线结果
    PutOnlineEndBearContents = "/item/saveOnlineEndBearContents",// 技术负责人/测试负责人对上线参与人评分
    SaveMsOnlineEndBearContents = "/item/saveMsOnlineEndBearContents",// 上传巡检文档
    PostSureOnline = "/item/sureOnline",// 待上线-今天上线时间
}

// 添加需求类型
// export const postAddRequirementType = (data: addRequirementTypeForm) => request.post<Common<{}>>(NewDemands.PostAddRequirementType, data);

//! 创建需求
export const postCreateRequirement = (data: createRequirementForm) => request.post<Common<any>>(NewDemands.PostCreateRequirement, data);

// 添加项目名称
export const postAddItmeItem = (data: addProjectNameForm) => request.post<Common<any>>(NewDemands.PostAddItemItem, data);

// 获取【我负责的需求】
export const postInitRequirement = (data: searchRequirementForm) => request.post<postInitRequirementData>(NewDemands.PostInitRequirement, data);

// 分配需求
export const postAvgRequirement = (data: postAvgRequirementForm) => request.post<Common<any>>(NewDemands.PostAvgRequirement, data);

// 关闭未分配需求
export const putCloseRequirementStatus = (data: putCloseFatherRequirementStatusForm) => request.put<Common<any>>(NewDemands.PutCloseFatherRequirementStatus, data);

// 获取【我的研发任务】
export const postPVPRequirement = (data: searchRequirementForm) => request.post<postPVPRequirementData>(NewDemands.PostPVPRequirement, data);

// 更新childStatus任务状态
export const putUpdateRequirementStatus = (data: putUpdateRequmentStatusForm) => request.put<Common<any>>(NewDemands.PutUpdateRequirementStatus, data);

// 更新fatherStatus任务状态
export const getNewFatherRequirementStatus = (data: getNewFatherRequirementForm) => request.put<Common<any>>(NewDemands.GetNewFatherRequirementStatus, data);

// 提交测试分支
export const postSubmitTestRequirement = (data: postSubmitTestRequirementForm) => request.post<Common<any>>(NewDemands.PostSubmitTestRequirement, data);

// 查询一个需求
export const PostRequirement = (data: getRequirementForm) => request.post<Common<any>>(NewDemands.PostRequirement, data);

// 获取【我创建的需求】数据
export const GetCreateRequirement = (data: searchRequirementForm) => request.post<Common<any>>(NewDemands.GetCreateRequirement, data);

// 获取【我待审核的需求】数据
export const GetEnterRequirement = (data: searchRequirementForm) => request.post<Common<any>>(NewDemands.GetEnterRequirement, data);

// 审核需求
export const PostReviewRequirementMsg = (data: postReviewRequirementMsgForm) => request.post<Common<any>>(NewDemands.PostReviewRequirementMsg, data);

// 催促审核
export const GetUrgedRequriement = (id: number) => request.get<Common<any>>(`${NewDemands.GetUrged}?id=${id}`);

// 选择技术负责人
export const PutUpdateBossName = (data: putAddOrUpdateRequirementBossNameForm) => request.put<Common<any>>(NewDemands.PutUpdateBossName, data);

// 获取需求审核记录
export const GetRequirementEnterMsg = (id: number) => request.get<Common<any>>(`${NewDemands.GetRequirementEnterMsg}?id=${id}`);

// 提交需求评审会议纪要
export const PutShowNeedTip = (data: putShowNeedTipForm) => request.put<Common<any>>(NewDemands.PutShowNeedTip, data);

// 获取提测人员列表
export const GetJoinTests = (id: number) => request.get<Common<getJoinTestData>[]>(`${NewDemands.GetJoinTests}?id=${id}`);

// 审核未通过时修改需求
export const PostAgainRequirement = (data: postAgainRequirementForm) => request.post<Common<any>>(NewDemands.PostAgainRequirement, data);

// 获取已经提测，未审核的需求
export const GetMyRequirementNoTip = (data: any) => request.get<Common<any>>(NewDemands.GetMyRequirementNoTip, data);

// 技术负责人审核详细设计请求参数
export const PutShowTipJTOY = (data: putShowTipJTOYForm) => request.put<Common<any>>(NewDemands.PutShowTipJTOY, data);

// 需求负责人撤回已关闭需求
export const PutReturnCloseFatherRequirementStatus = (data: putReturnFatherRequirementStatusForm) => request.put<Common<any>>(NewDemands.PutReturnCloseFatherRequirementStatus, data);

// TODO 需求详情
// 删除已分配人员
export const PostAvgDeleteRequirement = (data: postAvgDeleteRequirementForm) => request.post<Common<any>>(NewDemands.PostAvgDeleteRequirement, data);

// TODO 测试中
// 测试通过时测试对研发评分
export const PutShowTipCTOY = (data: putShowTipCTOYForm) => request.put<Common<any>>(NewDemands.PutShowTipCTOY, data);

// 测试负责人创建的任务测试通过
export const GetUpdateSubmitNotTips = (id: number) => request.get<Common<any>>(`${NewDemands.GetUpdateSubmitNotTips}?id=${id}`);

// 测试不通过时提交bug
export const PostSubmitTestStatus = (data: postSubmitTestStatusForm) => request.post<Common<any>>(NewDemands.PostSubmitTestStatus, data);

// 根据需求id获取bug列表
export const GetRequirementsBugs = (requirementId: number) => request.get<Common<any>>(`${NewDemands.GetRequirementsBugs}/${requirementId}`);

// 测试人员根据需求id获取给自己提测的研发人员名单
export const GetMySubmitByRequirementChild = (id: number) => request.get<Common<any>>(`${NewDemands.GetMySubmitByRequirementChild}?id=${id}`);

// 需求重新提测
export const PostSubmitTestRequirementTwo = (data: submitTestRequirementTwoForm) => request.post<Common<any>>(NewDemands.PostSubmitTestRequirementTwo, data);

// 研发人员重新提测时获取自己的测试人员名单
export const GetSubmitRequirementList = (id: number) => request.get<Common<any>>(`${NewDemands.GetSubmitRequirementList}?id=${id}`);

// 变更自己的提测记录为测试中
export const GetUpdateMySubmitByRequirementStatus = (id: number) => request.get<Common<any>>(`${NewDemands.GetUpdateMySubmitByRequirementStatus}?id=${id}`);

// 获取提测需求详情
export const GetSubmitTestMsg = (id: number) => request.get<Common<any>>(`${NewDemands.GetSubmitTestMsg}?id=${id}`);



// TODO 待上线评审
// 获取项目经理的待上线评审需求
export const PostManagerRequirement = (data: postManagerRequirementForm) => request.post<Common<any>>(NewDemands.PostManagerRequirement, data);

// 项目经理通知技术负责人上线评审【待上线评审】页面
export const GetManagerOnline = (id: number) => request.get<Common<any>>(`${NewDemands.GetManagerOnline}?id=${id}`);

// 项目经理填写上线评审会议纪要
export const GetSelectBareUsers = (id: number) => request.get<Common<getSelectBareUsersFormData>>(`${NewDemands.GetSelectBareUsers}?id=${id}`);

// 技术负责人分配参与上线人员
export const PostSelectBareUsers = (data: postSelectBareUsersForm) => request.post<Common<any>>(NewDemands.PostSelectBareUsers, data);

// 获取【我的上线任务】页面列表
export const GetMyBareMsg = () => request.get<Common<any>>(NewDemands.GetMyBareMsg);

// 提交上线评审负责内容
export const SubmitBearContent = (data: submitBearContentForm) => request.put<Common<any>>(NewDemands.SubmitBearContent, data);

// 项目经理通知所有上线参与人线下上线评审时间
export const PostOfflineBearContent = (data: postOfflineBearContentForm) => request.post<Common<any>>(NewDemands.PostOfflineBearContent, data);

// 项目经理填写上线评审会议纪要
export const PostOfflineBearContentMsg = (data: postOfflineBearContentMsgForm) => request.post<Common<any>>(NewDemands.PostOfflineBearContentMsg, data);

//获取上线评审需求各自负责的内容
export const GetGetBareUsersMsgs = (id: number) => request.get<Common<any>>(`${NewDemands.GetBareUsersMsgs}?id=${id}`);

// 更新参与上线评审的人各自负责的内容
export const PostUpdateBareUsersMsgs = (data: any) => request.post<any>(NewDemands.PostUpdateBareUsersMsgs, data);

//获取上线参与人列表
export const GetOnlineUsers = (id: number) => request.get<any>(`${NewDemands.GetOnlineUsers}?id=${id}`);

// 提醒编写上线负责任务
export const DingDingOnlineWriteBearContents = (id: number) => request.get<any>(`${NewDemands.DingDingOnlineWriteBearContents}?id=${id}`);


// TODO 待上线-技术负责人-【我负责的需求】
// 技术负责人提交上线结果，1、通过；2、不通过
export const PostOfflineToEnd = (data: postOfflineToEndForm) => request.post<Common<any>>(NewDemands.PostOfflineToEnd, data); 

// 技术负责人/测试负责人对上线参与人评分
export const PutOnlineEndBearContents = (data: putOnlineEndBearContentsForm[]) => request.put<Common<any>>(NewDemands.PutOnlineEndBearContents, data);

// 上传巡检文档
export const PutSaveMsOnlineEndBearContents = (data: any) => request.put<Common<any>>(NewDemands.SaveMsOnlineEndBearContents, data);

// 待上线-今天上线时间
export const PostSureOnline = (data: any) => request.post<Common<any>>(NewDemands.PostSureOnline, data);